package com.Web.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/Delete")
public class Delete extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // 设置请求参数编码
        req.setCharacterEncoding("UTF-8");
        // 设置响应数据编码
        resp.setCharacterEncoding("UTF-8");
        // 获取请求参数
        String id = req.getParameter("id");
        JDBCUtils.update("delete from student where id = ?",id);
        resp.getWriter().print("学生信息删除成功！");
    }
}
